Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for service file in pkg/estimator/client #5427

Merged

Conversation

yashpandey06
Copy link

What type of PR is this?
Added unit tests for service file in pkg/estimator/client

/kind failing-test

What this PR does / why we need it:
This PR introduces unit tests for the resolveCluster and findServicePort functions in the pkg/estimator/client package. These tests aim to cover various scenarios including handling of ExternalName services, port mismatches, and errors related to service port types. This ensures better test coverage and reliability of the service handling logic.

Which issue(s) this PR fixes:
Fixes issue with incomplete test coverage for service handling in the pkg/estimator/client package.

Fixes part of : #5235
Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. label Aug 26, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 26, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 30.90%. Comparing base (2537912) to head (ec41958).
Report is 4 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5427      +/-   ##
==========================================
- Coverage   31.05%   30.90%   -0.16%     
==========================================
  Files         639      639              
  Lines       44313    44343      +30     
==========================================
- Hits        13763    13703      -60     
- Misses      29556    29661     +105     
+ Partials      994      979      -15     
Flag Coverage Δ
unittests 30.90% <ø> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yashpandey06
Copy link
Author

@XiShanYongYe-Chang please help review this pr

@@ -0,0 +1,200 @@
/*
Copyright 2022 The Karmada Authors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XiShanYongYe-Chang fixed the required changes .

ktesting "k8s.io/client-go/testing"
)

func TestResolveCluster(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about writing the test function using a table drive?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sure , we can look into it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XiShanYongYe-Chang i have pushed the latest commits , we can process with review now !

@XiShanYongYe-Chang
Copy link
Member

/assign

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 27, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2024
@karmada-bot karmada-bot merged commit 98b2bda into karmada-io:master Aug 27, 2024
12 checks passed
@RainbowMango RainbowMango added this to the v1.11 milestone Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants